<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@include file="/context/mytags.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <title>稿费新增</title>
    <t:base type="jquery,easyui,tools,DatePicker"></t:base>
    <script type="text/javascript">
        var company;
        $(document).ready(function () {
            /*$.ajax({
                url: "businessUserMapController.do?getUserList",
                type: "GET",
                dataType: "JSON",
                async: false,
                success: function (data) {
                    var users = data.attributes.user;
                    document.getElementById('userNameSelect').length = 0;
                    for (var i = 0; i < users.length; i++) {
                        if (i == 0) {
                            $("#sysOrgCode").val(users[i].sysOrgCode);
                            $("#sysCompanyCode").val(users[i].sysCompanyCode);
                            $("#userCard").val(users[i].userCard);
                            $("#costAddr").val(users[i].costAddr);
                            $("#userName").val(users[i].userName);
                        }
                        var vcode = users[i].sysOrgCode + "," + users[i].sysCompanyCode + "," + users[i].userCard + "," + users[i].costAddr + "," + users[i].userName;;
                        var opt = new Option(users[i].userName, vcode);
                        document.getElementById('userNameSelect').options.add(opt);
                    }
                }
            });*/
            $.ajax({
                url: "businessOrderController.do?getDeptList",
                type: "GET",
                dataType: "JSON",
                async: false,
                success: function (data) {
                    if (data.success) {

                        var dept = data.attributes.dept;
                        var top;
                        if (dept.length > 0) {
                            for (var i = 0; i < dept.length; i++) {
                                var opt = new Option(dept[i].name, dept[i].code);
                                document.getElementById('sysOrgCode').options.add(opt);
                                if (i == 0) {
                                    top = dept[i].code;
                                }
                            }
                        }
                        company = data.attributes.comp;
                        if (company.length > 0) {
                            for (var i = 0; i < company.length; i++) {
                                if (top == company[i].parentCode) {
                                    var opt = new Option(company[i].name, company[i].code);
                                    document.getElementById('sysCompanyCode').options.add(opt);
                                }
                            }
                        }
                    }
                }
            });
        });

        function changeUserName(value) {
            if(value.indexOf(",")<0){
                return;
            }
            $("#sysOrgCode").val(value.split(",")[0]);
            document.getElementById('sysCompanyCode').length = 0;
            if (company.length > 0) {
                for (var i = 0; i < company.length; i++) {
                    if (value.split(",")[0] == company[i].parentCode) {
                        var opt = new Option(company[i].name, company[i].code);
                        document.getElementById('sysCompanyCode').options.add(opt);
                    }
                }
            }
            $("#sysCompanyCode").val(value.split(",")[1]);
            $("#userCard").val(value.split(",")[2]);
            $("#costAddr").val(value.split(",")[3]);
            $("#userName").val(value.split(",")[4]);
        }

        function changeOrgCode(parentCode) {
            document.getElementById('sysCompanyCode').length = 0;
            if (company.length > 0) {
                for (var i = 0; i < company.length; i++) {
                    if (parentCode == company[i].parentCode) {
                        var opt = new Option(company[i].name, company[i].code);
                        document.getElementById('sysCompanyCode').options.add(opt);
                    }
                }
            }
        }
        function callbackOrg(data){
            if(data.success){
                $("#userName").val("");
                $("#userCard").val("");
                $("#cost").val("");
                $("#costAddr").val("");
                $("#contribution").val("");
                $("#columnTime").val("");
                $("#columnNum").val("");
                tip(data.msg);
            }else{
                tip(data.msg);
            }
        }
    </script>
</head>
<body>
<t:formvalid formid="formobj" dialog="true" layout="table"
             action="businessOrderController.do?doAdd" callback="@Override callbackOrg">
    <input id="id" name="id" type="hidden" value="${businessOrderPage.id }"/>
    <table style="width: 960px;" cellpadding="0" cellspacing="1" class="formtable">
        <tr>
            <td align="right" style="width: 80px;">
                <label class="Validform_label">
                    序号:
                </label>
            </td>
            <td class="value" style="width: 380px;">
                <input id="number" name="number" type="text" maxlength="50" style="width: 150px" class="inputxt"
                       ignore="ignore"/>
                <span class="Validform_checktip"></span>
                <label class="Validform_label" style="display: none;">序号</label>
            </td>
            <td align="right" style="width: 80px;">
                <label class="Validform_label">
                    频道名称:
                </label>
            </td>
            <td class="value">
                <select name="sysOrgCode" onchange="changeOrgCode(this.value)" id="sysOrgCode" class="form-control"></select>
                <span class="Validform_checktip"></span>
                <label class="Validform_label" style="display: none;">频道名称</label>
            </td>
        </tr>

        <tr>
            <td align="right" style="width: 80px">
                <label class="Validform_label">
                    姓名:
                </label>
            </td>
            <td class="value" style="width: 399px;">
                <input id="userName" name="userName" type="text" maxlength="50" style="width: 100px" class="inputxt"
                       datatype="s"  />
                <input id="cc" class="easyui-combogrid" style="width:20px;height: 19px"  data-options="
			            panelWidth: 500,
			            idField: 'id',
			            editable: 'true',
			            textField: 'userName',
			            url: 'businessUserMapController.do?getUserListdatagrid&field=id,sysOrgCode,sysCompanyCode,userName,userCard,costAddr,orgCode,companyCode',
			            columns: [[
			                {field:'orgCode',title:'频道',width:80},
			                {field:'companyCode',title:'栏目',width:120},
			                {field: 'userName',title: '姓名',width: 120},
			                {field: 'userCard',title: '卡号',width: 120},
			                 {field: 'costAddr',title: '地址',width: 120}
			            ]],
			             fitColumns: true,
			              onChange: function (n,o) {
                             changeUserName(n);
                         }
			        ">


                <%--<select name="userNameSelect" onchange="changeUserName(this.value)" style="width: 100px" id="userNameSelect"
                ></select>--%>

            </td>
            <td align="right">
                <label class="Validform_label">
                    身份证号:
                </label>
            </td>
            <td class="value">
                <input id="userCard" name="userCard" type="text" maxlength="50" style="width: 150px" class="easyui-validatebox"
                       datatype="s" />
                <label class="Validform_label" style="display: none;">请输入正确的身份证号</label>
            </td>

        </tr>
        <tr>
            <td align="right">
                <label class="Validform_label">
                    金额:
                </label>
            </td>
            <td class="value">
                <input id="cost" class="easyui-numberbox" precision="2" datatype="s" errormsg="格式错误" name="cost"  type="text" maxlength="18" style="width: 150px"
                />
                <span class="Validform_checktip"></span>
                <label class="Validform_label" style="display: none;">金额</label>
            </td>
            <td align="right">
                <label class="Validform_label">
                    汇款地址/账号:
                </label>
            </td>
            <td class="value">
                <input id="costAddr" name="costAddr" type="text" maxlength="100" style="width: 150px"  class="easyui-validatebox"
                       ignore="ignore"/>
                <span class="Validform_checktip"></span>
                <label class="Validform_label" style="display: none;">汇款地址/账号</label>
            </td>
        </tr>
        <tr>
            <td align="right">
                <label class="Validform_label">
                    发放方式:
                </label>
            </td>
            <td class="value">
                <select  style="width:150px;" name="costPutout" id="costPutout" style="width: 100px">
                    <option value="现金">现金</option>
                    <option value="邮寄">邮寄</option>
                    <option value="银行转账">银行转账</option>
                </select>
            </td>
            <td align="right">
                <label class="Validform_label">
                    费用类型:
                </label>
            </td>
            <td class="value">
                <select  style="width:150px;" name="costType" id="costType">
                    <option value="稿费">稿费</option>
                    <option value="演播费">演播费</option>
                    <option value="区市通讯员">区市通讯员</option>
                    <option value="外媒记者连线">外媒记者连线</option>
                    <!-- <option value="新闻线索">新闻线索</option>
                    <option value="区市通讯员">区市通讯员</option>
                    <option value="交警路况信息">交警路况信息</option>
                    <option value="外媒记者连线">外媒记者连线</option>
                    <option value="股市分析评价">股市分析评价</option>
                    <option value="专家嘉宾解读评论">专家嘉宾解读评论</option> -->
                </select>
            </td>
        </tr>
        <tr>
            <td align="right">
                <label class="Validform_label">
                    工作类别:
                </label>
            </td>
            <td class="value">
                <select style="width:150px;" name="typeremark" id="typeremark">
                    <option value="策划">策划</option>
                    <option value="撰稿">撰稿</option>
                    <option value="主持">主持</option>
                    <option value="摄像">摄像</option>
                    <option value="编舞">编舞</option>
                    <option value="包装">包装</option>
                    <option value="演员">演员</option>
                    <option value="作曲">作曲</option>
                    <option value="编曲">编曲</option>
                    <option value="服装">服装</option>
                    <option value="化妆">化妆</option>
                    <option value="翻译">翻译</option>
                    <option value="解说">解说</option>
                    <option value="调解员">调解员</option>
                    <option value="资料提供">资料提供</option>
                    <option value="好稿评审">好稿评审</option>
                    <option value="后期制作">后期制作</option>
                    <option value="特约记者">特约记者</option>
                    <option value="演播室嘉宾">演播室嘉宾</option>
                    <option value="区市通讯员">区市通讯员</option>
                    <option value="音乐MIDI制作">音乐MIDI制作</option>
                    <option value="新闻线索提供">新闻线索提供</option>
                    <option value="交警路况信息">交警路况信息</option>
                    <option value="外媒记者连线">外媒记者连线</option>
                    <option value="股市分析评价">股市分析评价</option>
                    <option value="社会供稿">社会供稿</option>
                    <option value="驻省台外聘编辑">驻省台外聘编辑</option>
                    <option value="专家嘉宾解读评论">专家嘉宾解读评论</option>
                </select>
            </td>
            <td align="right">
            </td>
            <td class="value">
            </td>
        </tr>
        <tr>
            <td align="right">
                <label class="Validform_label">
                    稿件题目(内容):
                </label>
            </td>
            <td class="value">
                <input id="contribution" name="contribution" type="text" maxlength="32" style="width: 150px" class="inputxt"
                       ignore="ignore"/>
                <span class="Validform_checktip"></span>
                <label class="Validform_label" style="display: none;">稿件题目</label>
            </td>
            <td align="right">
                <label class="Validform_label">
                    栏目名称:
                </label>
            </td>
            <td class="value">
                <select name="sysCompanyCode" id="sysCompanyCode" class="form-control"></select>
                <span class="Validform_checktip"></span>
                <label class="Validform_label" style="display: none;">栏目名称</label>
            </td>
        </tr>
        <tr>
            <td align="right">
                <label class="Validform_label">
                    播出时间:
                </label>
            </td>
            <td class="value">
                <input id="columnTime" name="columnTime" type="text" maxlength="50" style="width: 150px" class="inputxt"
                       ignore="ignore"/>
                <span class="Validform_checktip"></span>
                <label class="Validform_label" style="display: none;">播出时间</label>
            </td>
            <td align="right">
                <label class="Validform_label">
                    字数/时长（分钟）:
                </label>
            </td>
            <td class="value">
                <input id="columnNum" name="columnNum" class="easyui-numberbox" precision="0"  maxlength="50" style="width: 150px"  type="text"/>
                <span class="Validform_checktip"></span>
                <label class="Validform_label" style="display: none;">字数时长版面</label>
            </td>
        </tr>
        <tr>
            <td align="right">
                <label class="Validform_label">
                    等级:
                </label>
            </td>
            <td class="value">
                <select  style="width:150px;" name="columnLev" id="columnLev">
                    <option value="甲">甲</option>
                    <option value="乙">乙</option>
                    <option value="丙">丙</option>
                </select>
            </td>
            <td align="right">
                <label class="Validform_label">
                    制单人:
                </label>
            </td>
            <td class="value">
                <input id="createName" name="createName" type="text" maxlength="50" style="width: 150px" class="inputxt" value="${userNa}" readonly="true"
                       ignore="ignore"/>
                <span class="Validform_checktip"></span>
                <label class="Validform_label" style="display: none;">制单人</label>
            </td>
        </tr>
        <tr>

            <td align="right">
                <label class="Validform_label">
                    编辑:
                </label>
            </td>
            <td class="value">
                <input id="orderEdit" name="orderEdit" type="text" maxlength="50" style="width: 150px" class="inputxt"
                       ignore="ignore"/>
                <span class="Validform_checktip"></span>
                <label class="Validform_label" style="display: none;">编辑</label>
            </td>
            <td align="right">
                <label class="Validform_label">
                    制片人:
                </label>
            </td>
            <td class="value">
                <input id="producer" name="producer" type="text" maxlength="50" style="width: 150px" class="inputxt"
                       ignore="ignore"/>
                <span class="Validform_checktip"></span>
                <label class="Validform_label" style="display: none;">制片人</label>
            </td>
        </tr>
        <tr>

            <td align="right">
                <label class="Validform_label">
                    部门主任:
                </label>
            </td>
            <td class="value">
                <input id="departManager" name="departManager" type="text" maxlength="32" style="width: 150px"
                       class="inputxt" ignore="ignore"/>
                <span class="Validform_checktip"></span>
                <label class="Validform_label" style="display: none;">部门主任</label>
            </td>
            <td align="right">
                <label class="Validform_label">
                    总监:
                </label>
            </td>
            <td class="value">
                <input id="producerManager" name="producerManager" type="text" maxlength="32" style="width: 150px"
                       class="inputxt" ignore="ignore" value="${checkmuser}" readonly="true"/>
                <span class="Validform_checktip"></span>
                <label class="Validform_label" style="display: none;">总监</label>
            </td>
        </tr>
        <tr>
            <td align="right">
                <label class="Validform_label">
                    备注/版面说明:
                </label>
            </td>
            <td class="value">
                <input id="comments" name="comments" type="text" maxlength="50" style="width: 150px" class="inputxt"
                       ignore="ignore"/>
                <span class="Validform_checktip"></span>
                <label class="Validform_label" style="display: none;">备注/版面说明</label>
            </td>
            <td align="right">
                <label class="Validform_label">
                    录入时间:
                </label>
            </td>
            <td class="value">
                <input id="createTime" name="createTime" readonly="true" type="text" maxlength="50" value="${createDate}" style="width: 150px" class="inputxt"
                       ignore="ignore"/>
                <span class="Validform_checktip"></span>
                <label class="Validform_label" style="display: none;">录入时间</label>
            </td>
        </tr>


        <%--<tr>
            <td align="right">
                <label class="Validform_label">
                    稿件题目(内容):
                </label>
            </td>
            <td class="value">
                <input id="contribution" name="contribution" type="text" maxlength="200" style="width: 150px"
                       class="inputxt" ignore="ignore"/>
                <span class="Validform_checktip"></span>
                <label class="Validform_label" style="display: none;">稿件题目(内容):</label>
            </td>
            <td align="right">
                <label class="Validform_label">
                </label>
            </td>
            <td class="value">
            </td>
        </tr>--%>
    </table>
</t:formvalid>
</body>
